let app = getApp()
Page({

    /**
     * 页面的初始数据
     */
    data: {

    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad(options) {
        let that = this;
        let d = app.globalData;
        this.setData({
            platform:d.platform,    
            //open:open,
            width:d.windowWidth,
            height:d.windowHeight,
            statusBarHeight:d.statusBarHeight,
            navHeight:d.navHeight,
            navWidth:d.navWidth,
            navRight:d.navRight,
            marginTop:d.navTitleTop,
            domain:d.domain,
            uploadUrl:d.uploadUrl,
          })
    },
    goBack(){
        wx.navigateBack();
    },
    goIndex(){
        var  url ='/pages/customer/index';
        console.log(url);
        wx.reLaunch({
          url:url
        })
    },
    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady() {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow() {
        this.getIndex();
    },
    call:function(e){
        console.log(e);
        var phone = e.currentTarget.dataset.phone;
        console.log(phone)
        wx.makePhoneCall({
          phoneNumber: phone,
        })
    },
    getIndex(){
        var d = this.data;
        let that = this;
        var open =  wx.getStorageSync('open');
        var data = [];
        data['user_id'] = open.user_id;
 
        var url = 'departs/index';

      app.request(url,data,'get').then(res=>{ 
        console.log('---customer ----lose to reject'); 
         console.log(res);
         that.setData({
             list:res.userlist
         })
         //app.showModals(res.msg,res.url,res.index);
         //that.getIndex();
      });
    },
    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide() {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload() {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh() {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom() {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage() {

    }
})